package com.his.his_system.controller;


import com.github.pagehelper.PageHelper;
import com.his.his_system.common.util.ResultAdvice;
import com.his.his_system.common.vo.PageHelp;
import com.his.his_system.domain.DzmHisAuthGroup;
import com.his.his_system.domain.DzmHisAuthPermissions;
import com.his.his_system.domain.DzmHisDepartment;
import com.his.his_system.service.DzmHisAuthGroupService;
import com.his.his_system.service.DzmHisAuthPermissionsService;
import com.his.his_system.service.DzmHisDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RequestMapping("/his/sys/auth_group/")
@RestController
@ResponseBody
public class AuthGroupController {
    @Autowired
    private DzmHisAuthGroupService authGroupService;


    @GetMapping("/list")
    public ResultAdvice list(@RequestParam(required = false) PageHelp param) {
        if (param != null) {
            PageHelper.startPage(param.getCurrentPage(),param.getPageSize());
        }
        List<DzmHisAuthGroup> list = authGroupService.list();
        return ResultAdvice.success(list,"全部组");
    }
    @PostMapping("/{id}")
    public ResultAdvice modify(@PathVariable Integer id,@RequestBody DzmHisAuthGroup dag) {
        System.out.println(dag);
        dag.setId(id);
        return ResultAdvice.success(authGroupService.updateById(dag));
    }

}
